/**
 * 
 */
package data.model.effort;

import data.EffortProvider;

/**

 * 
 */
public class CurrentEffort extends Effort {
	private EffortProvider basisEffort;
	private final EffortProvider deltaEffort;

	/**
	 * @param basisEffort
	 * @param deltaEffort
	 */
	public CurrentEffort(CurrentEffort basisEffort, DeltaEffort deltaEffort) {
		super("Current");
		setBasisEffort(basisEffort);
		if (deltaEffort == null) {
			this.deltaEffort = new DefinedEffort();
		} else {
			this.deltaEffort = deltaEffort;
			deltaEffort.addPropertyChangeListener(this);
		}
	}

	public void setBasisEffort(CurrentEffort basisEffort) {
		if (basisEffort == null) {
			this.basisEffort = new DefinedEffort();
		} else {
			this.basisEffort = basisEffort;
			basisEffort.addPropertyChangeListener(this);
		}
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortRequirementsEngineering()
	 */
	@Override
	public int getEffortRequirementsEngineering() {
		return basisEffort.getEffortRequirementsEngineering()
				+ deltaEffort.getEffortRequirementsEngineering();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortArchitectureAndDesign()
	 */
	@Override
	public int getEffortArchitectureAndDesign() {
		return basisEffort.getEffortArchitectureAndDesign()
				+ deltaEffort.getEffortArchitectureAndDesign();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortImplementationAndIntegration()
	 */
	@Override
	public int getEffortImplementationAndIntegration() {
		return basisEffort.getEffortImplementationAndIntegration()
				+ deltaEffort.getEffortImplementationAndIntegration();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortBuildAndTest()
	 */
	@Override
	public int getEffortBuildAndTest() {
		return basisEffort.getEffortBuildAndTest()
				+ deltaEffort.getEffortBuildAndTest();
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortProjectManagement()
	 */
	@Override
	public int getEffortProjectManagement() {
		return basisEffort.getEffortProjectManagement()
				+ deltaEffort.getEffortProjectManagement();
	}
}
